package com.foreknow.demo4;

import java.util.Scanner;

/**
 * 自定义一个方法实现冒泡排序
 */

public class TestMethod8Mine {
    public static int[] A() {
        int[] array = new int[7];
        Scanner input = new Scanner(System.in);
        System.out.println("请输入要比较的数组：");
        for (int j = 0;j<array.length;j++) {
            array[j] = input.nextInt();
        }
        for (int i = 1;i<array.length;i++) {
            for (int j = 0;j<array.length-i;j++) {
                if (array[j]>array[j+1]) {
                    int temp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = temp;
                }
            }
        }
        return array;
    }

    public static void main(String[] args) {
        int[] a = TestMethod8Mine.A();
        for (int i = 0;i<a.length;i++) {
            System.out.println(a[i]);
        }
    }


}
